// 函数式编程
const  arr = [1, 2, 3, 4];
let newArr = (arr, fn) => {
  let res = [];
  for(let i = 0; i < arr.length; i++) {
    res.push(fn(arr[i]));
  }
  return res
}
const add = item => item + 5;
let sum = newArr(arr, add);
console.log(sum);